#include "StdAfx.h"
#include "defender.h"
#include "machine/defendermachine.h"
/*
#define INPUT_PORT_START(name)		\
	InputPort ##name = { {

#define INPUT_PORT_END()			\
	} };

#define INPUT_PORT(nn,bb,vv,ff)		\
	{nn,bb,vv,ff},
	
#define INPUT_PORT_HIGH(nn,bb,vv)	\
	INPUT_PORT(nn,bb,vv,I_HIGH)

#define INPUT_PORT_LOW(nn,bb,vv)		\
	INPUT_PORT(nn,bb,vv,I_LOW)
	
#define INPUT_PORT_HIGH_UNUSED(vv)	\
	INPUT_PORT_HIGH("Unused",0,vv)

#define INPUT_PORT_LOW_UNUSED(vv)	\
	INPUT_PORT_LOW("Unused",0,vv)

INPUT_PORT_START(defenderPort1)
	INPUT_PORT_HIGH("Fire",			I_B1,			0x01)
	INPUT_PORT_HIGH("Thrust",		I_B2,			0x02)
	INPUT_PORT_HIGH("Smart Bomb",	I_B3,			0x04)
	INPUT_PORT_HIGH("Hyperspace",	I_B4,			0x08)
	INPUT_PORT_HIGH("Start 2",		I_START2,	0x10)
	INPUT_PORT_HIGH("Start 1",		I_START1,	0x20)
	INPUT_PORT_HIGH("Reverse",		I_B5,			0x40)
	INPUT_PORT_HIGH("Down",			I_DOWN,		0x80)
INPUT_PORT_END()

INPUT_PORT_START(defenderPort2)
	INPUT_PORT_HIGH("Up",			I_UP,			0x01)
	INPUT_PORT_HIGH_UNUSED(							0x02)
	INPUT_PORT_HIGH_UNUSED(							0x04)
	INPUT_PORT_HIGH_UNUSED(							0x08)
	INPUT_PORT_HIGH_UNUSED(							0x10)
	INPUT_PORT_HIGH_UNUSED(							0x20)
	INPUT_PORT_HIGH_UNUSED(							0x40)
	INPUT_PORT_HIGH_UNUSED(							0x80)
INPUT_PORT_END()

INPUT_PORT_START(defenderPort3)
	INPUT_PORT_HIGH("Auto Up",				I_AUTOUP,	0x01)
	INPUT_PORT_HIGH("Advance",				I_ADVANCE,	0x02)
	INPUT_PORT_HIGH("Coin 3",				I_COIN3,		0x04)
	INPUT_PORT_HIGH("High Score Reset",	I_HRESET,	0x08)
	INPUT_PORT_HIGH("Coin 1",				I_COIN1,		0x10)
	INPUT_PORT_HIGH("Coin 2",				I_COIN2,		0x20)
	INPUT_PORT_HIGH("Tilt",					I_TILT,		0x40)
	INPUT_PORT_HIGH_UNUSED(									0x80)
INPUT_PORT_END()
*/
InputPort defenderPort1 =
	{
		{
		{"Fire",			I_B1,			0x01,	I_HIGH},
		{"Thrust",		I_B2,			0x02,	I_HIGH},
		{"Smart Bomb",	I_B3,			0x04,	I_HIGH},
		{"Hyperspace",	I_B4,			0x08,	I_HIGH},
		{"Start 2",		I_START2,	0x10,	I_HIGH},
		{"Start 1",		I_START1,	0x20,	I_HIGH},
		{"Reverse",		I_B5,			0x40,	I_HIGH},
		{"Down",			I_DOWN,		0x80,	I_HIGH},
		}
	};

InputPort defenderPort2 =
	{
		{
		{"Up",			I_UP,			0x01,	I_HIGH},
		{"Unknown",		0,				0x02,	I_HIGH},
		{"Unknown",		0,				0x04,	I_HIGH},
		{"Unknown",		0,				0x08,	I_HIGH},
		{"Unknown",		0,				0x10,	I_HIGH},
		{"Unknown",		0,				0x20,	I_HIGH},
		{"Unknown",		0,				0x40,	I_HIGH},
		{"Unknown",		0,				0x80,	I_HIGH},
		}
	};

InputPort defenderPort3 =
	{
		{
		{"Auto Up",				I_UP,			0x01,	I_HIGH},
		{"Advance",				I_ADVANCE,	0x02,	I_HIGH},
		{"Coin 3",				I_COIN3,		0x04,	I_HIGH},
		{"High Score Reset",	I_HRESET,	0x08,	I_HIGH},
		{"Coin 1",				I_COIN1,		0x10,	I_HIGH},
		{"Coin 2",				I_COIN2,		0x20,	I_HIGH},
		{"Tilt",					I_TILT,		0x40,	I_HIGH},
		{"Unknown",				0,				0x80,	I_HIGH},
		}
	};

static highscore_t highscore[] =
	{
	{0xB260,0x60,0x00,0x48},
	{0,-1}
	};

Cdefender::Cdefender()
{
SetName("defender");						//set romset name
SetScreen(304,256);
SetHighScoreInfo(highscore);
SetPort(0,&defenderPort1);
SetPort(1,&defenderPort2);
SetPort(2,&defenderPort3);
AddROM("defend.1",	0xD000,0x0800,0xc3e52d7e,ROM_CPU1);
AddROM("defend.4",	0xD800,0x0800,0x9a72348b,ROM_CPU1);
AddROM("defend.2",	0xE000,0x1000,0x89b75984,ROM_CPU1);
AddROM("defend.3",	0xF000,0x1000,0x94f51e9b,ROM_CPU1);
AddROM("defend.9",	0x10000,0x0800,0x6870e8a5,ROM_CPU1);
AddROM("defend.12",	0x10800,0x0800,0xf1f88938,ROM_CPU1);
AddROM("defend.8",	0x11000,0x0800,0xb649e306,ROM_CPU1);
AddROM("defend.11",	0x11800,0x0800,0x9deaf6d9,ROM_CPU1);
AddROM("defend.7",	0x12000,0x0800,0x339e092e,ROM_CPU1);
AddROM("defend.10",	0x12800,0x0800,0xa543b167,ROM_CPU1);
AddROM("defend.6",	0x16000,0x0800,0x65f4efd1,ROM_CPU1);
AddROM("defend.snd",	0xF800,0x0800,0xfefd5b48,ROM_CPU2);
AddROM("decoder.2",	0x0000,0x0200,0x8dd98da5,ROM_PROM);
AddROM("decoder.3",	0x0200,0x0200,0xc3f45f70,ROM_PROM);
}

CMachine *Cdefender::CreateMachine()
{
return(new CDefenderMachine());
}
